package com.hz.ruoyiequipment.equipment.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hz.ruoyiequipment.equipment.domain.AgrEnvRegulation;
import com.hz.ruoyiequipment.equipment.domain.AgrEnvRegulationDetail;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * @author 高铭月
 * @date 2025/3/7 11:02
 * @description:
 */
public interface AgrEnvRegulationMapper extends BaseMapper<AgrEnvRegulation> {
    /**
     * 查询设备列表信息
     * @param agrEnvRegulation
     * @return
     */
    List<AgrEnvRegulation> getAgrEnvRegulation(AgrEnvRegulation agrEnvRegulation);
    /**
     * 根据设备ID查询设备信息
     * @param equipmentId
     * @return
     */
    AgrEnvRegulationDetail getAgrEnvRegulationByEquipmentId(Long equipmentId);
    AgrEnvRegulationDetail getAgrEnvRegulationByEquipmentIdInner(Long equipmentId);


    /**
     * 更新设备状态
     * @param equipmentId
     * @param status
     * @return
     */
    int updateStatus(@Param("equipmentId") Long equipmentId,
                     @Param("status") Integer status);


    /**
     * 新增设备信息
     * @param regulation
     * @return
     */
    int insertAgrEquipment(AgrEnvRegulation regulation);
    int insertAgrEnvRegulation(AgrEnvRegulation regulation);
    int insertAgrEquipmentPlots(@Param("equipmentId") Long equipmentId, @Param("plotsId") Long plotsId);

    /**
     * 修改设备信息
     * @param regulation
     * @return
     */
    int updateAgrEquipment(AgrEnvRegulation regulation);
    int updateAgrEnvRegulation(AgrEnvRegulation regulation);

    @Delete("DELETE FROM agr_equipment_plots WHERE equipment_id = #{equipmentId}")
    int deleteAgrEquipmentPlots(Long equipmentId);
    @Delete("DELETE FROM agr_equipment WHERE equipment_id = #{equipmentId}")
    int deleteAgrEquipment(Long equipmentId);
    @Delete("DELETE FROM agr_env_regulation WHERE equipment_id = #{equipmentId}")
    int deleteAgrEnvRegulation(Long equipmentId);



}
